package com.weixing.mall.provider.api.service;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.provider.api.fallback.ProductStockFallBack;
import com.weixing.mall.provider.api.model.vo.ProductStockDetailsVo;
import com.weixing.mall.provider.api.model.vo.ProductStockVo;
import com.weixing.mall.provider.api.model.vo.dto.ErpSyncDto;
import com.weixing.mall.provider.api.model.vo.dto.RpcProductStockDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author wx
 * @Date 2019/12/6 16:21
 * @Version 1.0
 */
@FeignClient(value ="mall-provider-depot",configuration = FeignRibbonClientAutoConfiguration.class,fallback = ProductStockFallBack.class)
public interface ProductStockServiceRpc {
    @GetMapping("api/productStock/getByGoodsInfo")
    public Result<Integer> getByGoodsInfo(@RequestParam(value = "depotId",required = false)Long depotId, @RequestParam(value = "goodsId",required = false)Long goodsId, @RequestParam(value = "productId",required = false)Long productId);

    @GetMapping("api/productStock/getAllByDepotId")
    List<ProductStockVo> getAllByDepotId(@RequestParam(value = "depotId",required = false)Long depotId);
    @GetMapping("api/productStock/inOutStock")
    Result  inOutStock(@RequestParam(value = "depotId",required = false)Long depotId,@RequestParam(value = "productId",required = false)Long productId,@RequestParam(value = "flag",required = false)Integer flag,@RequestParam(value = "uid",required = false)Long uid,@RequestParam(value = "stockSn",required = false)String stockSn);

    @GetMapping("api/productStock/updateSynData")
    Result updateSynData(@RequestParam(value = "yearMonth")String yearMonth);

    @GetMapping("api/productStock/delSyncErpData")
    Result delSyncErpData(@RequestParam(value = "depotId")Long depotId);

    @PostMapping("api/productStock/erpSynData")
    Result erpSynData(@RequestBody ErpSyncDto erpSyncDto);


    @GetMapping("api/productStock/getAllByDepotId2")
    List<ProductStockDetailsVo> getAllByDepotId2(@RequestParam(value = "depotId")Long depotId);


    @GetMapping("api/productStock/lockDepot")
    Result lockDepot(@RequestParam(value = "id")Long id);
}
